#include<iostream>
using namespace std;
//class B1 {
//public:
//	virtual void fun1() {
//		cout << "fun1()" << endl;
//	}
//
//};
//class B2 {
//public:
//	virtual void fun3() {
//		cout << "fun3()" << endl;
//	}
//};
//class D :public B1, public B2 {
//	virtual void fun1() {
//		cout << "D fun1()" << endl;
//	}
//	virtual void fun3() {
//		cout << "D fun3()" << endl;
//	}
//	virtual void fun5() {
//		cout << "fun5()" << endl;
//	}
//};
//int main(){
//	B1 b1;
//	B2 b2;
//	D d;
//	PrintVFPtr((VFTPTR*)(*(int*)&d));
//	return 0;
//}
typedef void(*VFTPTR)();

void PrintVFPtr(VFTPTR a[])
{
	for (size_t i = 0; a[i] != 0; i++)
	{
		printf("a[%d]:%p->", i, a[i]);
		VFTPTR p = a[i];
		p();
	}
	cout << endl;
}
class Base1 {
public:
	virtual void func1() { cout << "Base1::func1" << endl; }
	virtual void func2() { cout << "Base1::func2" << endl; }
private:
	int b1;
};
class Base2 {
public:
	virtual void func1() { cout << "Base2::func1" << endl; }
	virtual void func2() { cout << "Base2::func2" << endl; }
private:
	int b2;
};
class Derive : public Base1, public Base2 {
public:
	virtual void func1() { cout << "Derive::func1" << endl; }
	virtual void func3() { cout << "Derive::func3" << endl; }
private:
	int d1;
};
int main()
{
	Derive d;
	PrintVFPtr((VFTPTR*)(*(long long*)&d));
	return 0;
}